import ProTable, {ActionType} from '@ant-design/pro-table';
import {useRef, useState} from 'react';
import {defaultPagination, paginationTool} from '@/utils/util';
import {useMount, useRequest} from 'ahooks';

import {editAgent, findByPageList} from '@/services/ant-design-pro/agent';
import {Button, message, Modal, Tag} from 'antd';
import {PlusOutlined} from '@ant-design/icons';

import {BetaSchemaForm, ProFormColumnsType, ProFormInstance} from '@ant-design/pro-form';
import {ColumnsType} from 'antd/lib/table';
import {findByDataCategoryTreeList} from "../../services/ant-design-pro/menu";
import {agentDistributionList, agentDistributionNav} from "../../services/ant-design-pro/permession";
import {findByCategoryDataList} from "@/services/ant-design-pro/video";



const cloneTbale = () => {

  const columns = [
    {
      title: '编号',
      dataIndex: 'index',
      key: 'index',
      valueType: 'indexBorder',
    },

    {
      title: '名称',
      dataIndex: 'name',
      key: 'name',
    },
    {
      title: '维语名称',
      dataIndex: 'nameUg',
      key: 'nameUg',
      search: false,
    }
  ];

  const columnDialog: ProFormColumnsType<API.Agent>[] = [
    {
      title: '基本信息',
      valueType: 'group',
      columns: [
        {
          title: 'id',
          dataIndex: 'id',
          key: 'id',

          formItemProps: {
            hidden: true,
          },
        },
        {
          title: '名称',
          dataIndex: 'name',
          key: 'name',
          width: 'md',
          width: 'md',
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
        },
        {
          title: '维语名称',
          dataIndex: 'nameUg',
          key: 'nameUg',
          width: 'md',
          width: 'md',
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
        },
        {
          title: '代理金额',
          dataIndex: 'price',
          key: 'price',
          valueType: 'money',
          width: 'md',
          width: 'md',
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
        },
        {
          title: '等级',
          dataIndex: 'level',
          key: 'level',
          width: 'md',
          valueType: 'digit',
          formItemProps: {
            rules: [
              {
                required: true,
                message: '此项为必填项',
              },
            ],
          },
        },
      ],
    },
  ];



  const {
    run: fetchByPageList,
    refresh,
    data: dataList,
    loading,
  } = useRequest ( findByCategoryDataList, {
    debounceWait: 100,
    manual: true,
  } );



  //
  useMount ( () => {
    fetchByPageList ();

  } );






  return (
    <div>


      <ProTable
        search={false}

        onDataSourceChange={(d) => {
          console.log ( 'onDataSourceChange', d );
        }}
        onLoad={(d) => {
          // 数据加载完操作
          console.log ( 'onDataSourceChange', d );
        }}

        dataSource={dataList?.data}
        loading={loading}

        search={false}
        cardBordered={true}
        columns={columns}
      ></ProTable>
    </div>
  );
};

export default cloneTbale;
